package com.yanqu.road.server.cmd.tradewar.cross;

import com.yanqu.road.pb.cross.tradewar.CrossTradeWarProto;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.player.TradeWarModule;
import com.yanqu.road.server.manger.activity.TradeWarActivityMgr;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.Protocol;

@Cmd(code = Protocol.S_CROSS_TRADE_WAR_WANTED_LIST, desc = "跨服商战通缉列表")
public class CrossTradeWarWantedListCmd extends AbstractCommand {

	private int activityId;

	@Override
	public boolean parseData(YanQuMessage packet) throws Exception {
		CrossTradeWarProto.CrossTradeWarWantedListReqMsg reqMsg = CrossTradeWarProto.CrossTradeWarWantedListReqMsg.parseFrom(packet.getBytes());
		activityId = reqMsg.getActivityId();
		return true;
	}

	@Override
	public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
		if(TradeWarActivityMgr.canCrossTradeWar(activityId, player.getUserId())) {
			player.getModule(TradeWarModule.class).sendCrossGetWantedList(activityId);
		}
	}

	@Override
	public void sendData(GamePlayer player) {

	}
}
